package com.laivi.basic.type.orm;

/**
 * @author laivi.zhu@gmail.com
 * @date 2014-7-5
 * description:
 */
public enum GenerateSQLServerColumn {

	STRING("class java.lang.String","nvarchar(255)"),
	LONG("long","bigint"),
	INT("int","int"),
	BOOLEAN("boolean","tinyint(1)"),
	DATE("class java.util.Date","datetime");
	
	private final String type;
	private final String column;
	
	GenerateSQLServerColumn(String type,String column){
		this.type=type;
		this.column=column;
	}
	
	public String toType(){
		return this.type;
	}
	
	public String toColumn(){
		return this.column;
	}
	
	public static GenerateSQLServerColumn fromType(String type){
		for(GenerateSQLServerColumn tempColumn:values()){
			if(tempColumn.toType().equals(type)){
				return tempColumn;
			}
		}
		return GenerateSQLServerColumn.STRING;
	}
}
